package com.wang.hw.hw3;

public class Trapezoid implements IShape{
    private double topBase;
    private double bottomBase;
    private double waist;
    private double height;

    public Trapezoid() {
    }

    public Trapezoid(double topBase, double bottomBase, double waist, double height) {
        this.topBase = topBase;
        this.bottomBase = bottomBase;
        this.waist = waist;
        this.height = height;
    }

    @Override
    public double getPerimeter() {
        return topBase + bottomBase + waist * 2;
    }

    @Override
    public double getArea() {
        return ((topBase + bottomBase) * height) / 2;
    }
}
